{% extends "base.html" %}

{% block title13 %}
    active
{% endblock %}

{% block page-body %}
    <h1 class="page-header">数据添加</h1>

    <!--面板 开始-->
    <div class="panel panel-primary">
    <div class="panel-heading">基线加固</div>
    <div class="panel-body">
        <form class="form-inline" action="/add_myworkbaseline/" method="post">
            {% csrf_token %}
            <div class="form-group">
                <label for="ip">IP</label>
                <input name="ip" type="text" class="form-control" id="ip" value="10.">
            </div>
            <div class="form-group">
                <label for="date">加固日期</label>
                <input name="date" type="date" class="form-control" id="date">
            </div>


            <div class="form-group"><strong>选择系统版本</strong>
                <select name="os" class="form-control">

                    {% for i in os %}
                        <option selected value="{{ i.id }}">{{ i.os }}</option>
                    {% endfor %}
                </select>
            </div>
            <button type="submit" class="btn btn-success">添加</button>
        </form>
        <!--面板body 结束-->
    </div>
{% endblock %}

{% block page-script %}
    <script language="JavaScript">
        //自动获取当前日期开始
        // 给input  date设置默认值
        var now = new Date();
        //格式化日，如果小于9，前面补0
        var day = ("0" + now.getDate()).slice(-2);
        //格式化月，如果小于9，前面补0
        var month = ("0" + (now.getMonth() + 1)).slice(-2);
        //拼装完整日期格式
        var today = now.getFullYear() + "-" + (month) + "-" + (day);
        //完成赋值
        $('#date').val(today);
        //自动获取当前日期结束
    </script>
{% endblock %}
